﻿using System;
using System.IO;

namespace Program11
{
    class Program
    {
        //Directory 文件夹得处理
        static void Main(string[] args)
        {
            //创建文件夹
            //Directory.CreateDirectory(@"d:\AAA");

            //Console.WriteLine("创建成功");

            //删除文件夹
            //try
            //{
            //    Directory.Delete(@"d:\AAA");
            //    Console.WriteLine("删除成功");
            //}
            //catch
            //{
            //    Console.WriteLine("删除失败！");

            //}
            //移动
            //string sourceFolder = @"d:\AAA";
            //string targetFolder = @"d:\BBB";
            //Directory.Move(sourceFolder, targetFolder);
            //Console.WriteLine("移动成功");



            //查询文件夹
            //判断某个文件夹是否存在
            //if (Directory.Exists(@"d:\AAA"))
            //{
            //    for (int i = 1; i <= 100; i++)
            //    {
            //        Directory.CreateDirectory(@"d:\AAA\"+ i);
            //    }
            //}

            //列出文件夹
            //string keyPath = "100";
            //string[] path = Directory.GetDirectories(@"d:\AAA");
            //foreach (var p in path)
            //{
            //    if (p.Contains(keyPath))
            //    {
            //        Console.WriteLine(p);
            //        break;
            //    }
            //}

            //列出文件,查询文件
            string[] flies = Directory.GetFiles(@"d:\AAA", "*.jpg");
            foreach (var f in flies)
            {
                Console.WriteLine(f);
            }
        }
    }
}
